/**
 *
 * @param {array} fids
 * @param {number} layerID
 * @param {function} onSuccess
 */
export function deleteFeature(
  { docName, fids, layerID, docLayer, ip = 'localhost', port = 6163 },
  onSuccess
) {
  //获取当前选择的要素编号
  var deleteService = new Zondy.Service.EditDocFeature(docName, layerID, {
    ip,
    port, //访问IGServer的端口号，.net版为6163，Java版为8089
  });
  if (onSuccess) {
    deleteService.deletes(fids.join(','), onSuccess);
    return;
  }
  deleteService.deletes(fids.join(','), querySuccess(docLayer));
}
// deleteLine()
//删除线要素回调函数
export function querySuccess(docLayer) {
  return function (data) {
    if (data.succeed) {
      alert(`已删除要素`);
      docLayer.refresh();
      // docLayer.refresh();
    } else {
      alert('删除要素失败！');
    }
  };
}
